home *** CD-ROM | disk | FTP | other *** search
- // sockunix.C -*- C++ -*- socket library
- // Copyright (C) 1992,1993 Gnanasekaran Swaminathan <gs4t@virginia.edu>
- //
- // Permission is granted to use at your own risk and distribute this software
- // in source and binary forms provided the above copyright
- // notice and this paragraph are preserved on all copies.
- // This software is provided "as is" with no express or implied warranty.
- //
- // Version: 31Jan93 1.3
-
- #include <sockunix.h>
-
- extern "C" {
- int socket (int domain, int type, int proto);
- }
-
- sockunixaddr::sockunixaddr (const char* path)
- {
- sun_family = sockunixbuf::af_unix;
- ::strcpy (sun_path, path);
- }
-
- sockunixbuf::sockunixbuf (sockbuf::type ty, int proto=0)
- : sockbuf (af_unix, ty, proto)
- {}
-
- sockunixbuf& sockunixbuf::operator = (sockbuf& su)
- {
- this->sockbuf::operator = (su);
- return *this;
- }
-
- sockbuf* sockunixbuf::open (type st, int proto)
- {
- *this = sockunixbuf (st, proto);
- return this;
- }
-
- void sockunixbuf::bind (sockAddr& sa)
- {
- sockbuf::bind (sa);
- }
-
- void sockunixbuf::bind (const char* path)
- {
- sockunixaddr sa (path);
- bind (sa);
- }
-
- void sockunixbuf::connect (sockAddr& sa)
- {
- sockbuf::connect (sa);
- }
-
- void sockunixbuf::connect (const char* path)
- {
- sockunixaddr sa (path);
- connect (sa);
- }
-
- isockunix::isockunix (sockbuf::type ty, int proto)
- : ios (new sockunixbuf (ty, proto))
- {
- unsetf (ios::dont_close); // ios::~ios deletes rdbuf()
- }
-
- isockunix::isockunix (const sockbuf& sb)
- : ios (new sockunixbuf (sb))
- {
- unsetf (ios::dont_close); // ios::~ios deletes rdbuf()
- }
-
- osockunix::osockunix (sockbuf::type ty, int proto)
- : ios (new sockunixbuf (ty, proto))
- {
- unsetf (ios::dont_close); // ios::~ios deletes rdbuf()
- }
-
- osockunix::osockunix (const sockbuf& sb)
- : ios (new sockunixbuf (sb))
- {
- unsetf (ios::dont_close); // ios::~ios deletes rdbuf()
- }
-
- iosockunix::iosockunix (sockbuf::type ty, int proto)
- : ios (new sockunixbuf (ty, proto))
- {
- unsetf (ios::dont_close); // ios::~ios deletes rdbuf()
- }
-
- iosockunix::iosockunix (const sockbuf& sb)
- : ios (new sockunixbuf (sb))
- {
- unsetf (ios::dont_close); // ios::~ios deletes rdbuf()
- }
-